<%@ page contentType="text/html; charset=utf-8" %>
<%@ include file="/WEB-INF/jsp/com/include/declare.jspf" %>
<%@ include file="/WEB-INF/jsp/com/include/doctype.jspf" %>
</head>

<script type = "text/javascript" language = "javascript">

function numbersOnly(obj)
{
    var str = obj.value;
   
    if(str.length > 0)
    {/*
        if(isNaN(str) == true )
        {
            alert("숫자만 입력 가능합니다");
            obj.value = "";
            return false;
        }  
    */
    }
    
    var regEx_hp_N = new RegExp("[0-9]");
    
 
    
    for(var  i = 0 ; i < str.length ; i++){
        
        var str1 = str.charAt(i);
     
        var result_hp = regEx_hp_N.exec(str1);
        if(!result_hp)
       {    
            alert("숫자만 입력 가능합니다");
            obj.value = "";
            return false;        
       }
       
               
    }
     

    return true;
    
}

function findPwByHp(){
    
    var frm = $("#findNewPwForm")[0];

   
 
    var newPwMsg = document.getElementById("newPwMsg");
    var mobileCom = document.getElementById("mobileCom");
    var telPrx = document.getElementById("telPrx");
    var telTail = document.getElementById("telTail");


    if (telPrx.value == "") {
        alert("휴대전화 번호 앞자리를 입력하십시요");
        telPrx.focus();
        return ;
    }    
    if (telTail.value == "") {
        alert("휴대전화 번호 뒷자리를 입력하십시요");
        telTailx.focus();
        return ;
    }     
    
    var fullHpNo = mobileCom.value +'-' + telPrx.value + '-' + telTail.value ; 
   

    $.post("<c:url value='/mbr/findNewPwByPh.do'/>",
               {
                   'fullHpNo'     : fullHpNo
               },
               function(data){
                   var result={};
                   var items = $(data).find("item");
                   items.each(function(index,element){
                      var name = $(this).find("name").text();
                      var value = $(this).find("value").text();
                      result[name] = value;
                   });
                   if(result["result"] =="OK"){
                       newPwMsg.innerHTML="등록된 이메일로 임시 비밀번호를 전송하였습니다..";

                   }
                   else{
                       newPwMsg.innerHTML="등록된 이메일이 존재하지 않습니다.";
                   }
                   return false;      
               }  
           );    
}




function findPwByEml(){
    
    var frm = $("#findNewPwForm")[0];

    
 
    var newPwMsg = document.getElementById("newPwMsg");
    var mbrEmlPrx = document.getElementById("mbrEmlPrx");
    var mbrEmlTail = document.getElementById("mbrEmlTail");
    var selEmlTail = document.getElementById("selEmlTail");


    if (mbrEmlPrx.value == "") {
        alert("이메일 아이디를 입력하십시요");
        mbrEmlPrx.focus();
        return ;
    }    
    if ((selEmlTail.value == "" ) && (mbrEmlTail.value == "")) {
        alert("이메일 제공회사를 입력하십시요");
        mbrEmlTail.focus();
        return ;
    }     

     
    var mbrEml = mbrEmlPrx.value +'@' +  mbrEmlTail.value  ; 
    

    $.post("<c:url value='/mbr/findNewPwByEml.do'/>",
               {
                   'mbrEml'     : mbrEml
               },
               function(data){
                   var result={};
                   var items = $(data).find("item");
                   items.each(function(index,element){
                      var name = $(this).find("name").text();
                      var value = $(this).find("value").text();
                      result[name] = value;
                   });
                   if(result["result"] =="OK"){
                       newPwMsg.innerHTML="등록된 이메일로 임시 비밀번호를 전송하였습니다..";

                   }
                   else{
                       newPwMsg.innerHTML="등록된 이메일이 존재하지 않습니다.";
                   }
                   return false;      
               }  
           );    
}


function findNnewPwByHpEml(){
    
    var frm = $("#findNewPwForm")[0];

    
 
    var newPwMsg = document.getElementById("newPwMsg");
    
    var mobileCom = document.getElementById("mobileCom");
    var telPrx = document.getElementById("telPrx");
    var telTail = document.getElementById("telTail");

    var mbrEmlPrx = document.getElementById("mbrEmlPrx");
    var mbrEmlTail = document.getElementById("mbrEmlTail");
    var selEmlTail = document.getElementById("selEmlTail");


    if (telPrx.value == "") {
        alert("휴대전화 번호 앞자리를 입력하십시요");
        telPrx.focus();
        return ;
    }    
    if (telTail.value == "") {
        alert("휴대전화 번호 뒷자리를 입력하십시요");
        telTailx.focus();
        return ;
    }     
    
    var fullHpNo = mobileCom.value + '-' + telPrx.value + '-' +telTail.value ; 
  
    
    
    if (mbrEmlPrx.value == "") {
        alert("이메일 아이디를 입력하십시요");
        mbrEmlPrx.focus();
        return ;
    }    
    if ((selEmlTail.value == "" ) && (mbrEmlTail.value == "")) {
        alert("이메일 제공회사를 입력하십시요");
        mbrEmlTail.focus();
        return ;
    }     

    
    
    
    var mbrEml = mbrEmlPrx.value +"@" +  mbrEmlTail.value  ; 
    

    $.post("<c:url value='/mbr/findNewPwByHpEml.do'/>",
               {
                   'fullHpNo'   : fullHpNo,
                   'mbrEml'     : mbrEml
               },
               function(data){
                   var result={};
                   var items = $(data).find("item");
                   items.each(function(index,element){
                      var name = $(this).find("name").text();
                      var value = $(this).find("value").text();
                      result[name] = value;
                   });
                   if(result["result"] =="OK"){
                      // newPwMsg.innerHTML="등록된 이메일로 임시 비밀번호를 전송하였습니다..";
                      alert("등록된 이메일로 임시 비밀번호를 전송하였습니다..");
                      var frm = $("#findNewPwForm")[0];
                      frm.action="<c:url value='/index.do'/>";
                     
                     frm.submit();     
                     return false;
                   }
                   else{
                       //newPwMsg.innerHTML="등록된 이메일이 존재하지 않습니다.";
                       alert("등록된 이메일이 존재하지 않습니다.");
                       var frm = $("#findNewPwForm")[0];
                       frm.action="<c:url value='/index.do'/>";
                      
                      frm.submit();   
                   }
                   return false;      
               }  
           );    
}



function svrcomChg(){
    

    
    var svrcom =  document.getElementById("selEmlTail");


    
  
    if(svrcom.value == "")
    {  //직접입력의 경우 이메일제공회사를 입력한 후에 아이디 체크가 이루어 져야한다.
        document.getElementById("mbrEmlTail").value = "";
        document.getElementById("mbrEmlTail").disabled = false;
        document.getElementById("mbrEmlTail").focus();
    }
    else 
    {
        document.getElementById("mbrEmlTail").value =svrcom.value;

        document.getElementById("mbrEmlTail").disabled = true;

    }


}
</script>



<body>


 <div id="wrap" class="non-subnavigation02">
    <%@ include file="/WEB-INF/jsp/com/include/navi_utill_sub.jspf" %>
    <%@ include file="/WEB-INF/jsp/com/include/navi_header.jspf" %>
    <hr />

    <%@ include file="/WEB-INF/jsp/com/include/sub_header_global01.jspf" %>
    <hr />


<form id="findNewPwForm" name="findNewPwForm" method="post" onsubmit="return false">
	<div id="container">
		<div id="subtitle-area"><div class="subtitle-area-inner">
			<%@ include file="/WEB-INF/jsp/com/include/location.jspf" %>
		</div></div>
		<div id="article">
    
			<h4 class="in-contents"><img src="/kr/images/title/h4_global_menu01_04.gif" alt="비밀번호 찾기_휴대폰_번호 이용" /></h4>
			<p><img src="/kr/images/title/h4_global_menu01_04_desc.gif" alt="회원가입 시 등록하신 휴대폰 번호로 회원님의 비밀번호를 찾습니다." /></p>
			<div class="boardwrite-wrap02 subsection02">
				<table summary="통신사 선택, 휴대전화 번호">
				<caption>휴대폰정보 작성</caption>
				<colgroup>
					<col width="13%" />
					<col width="87%" />
				</colgroup>
				<tbody>
				<tr>
					<th scope="row"><img src="/kr/images/global_menu/txt_global_menu01_01_02.gif" alt="휴대전화 번호" /></th>
					<td>
                        <select class="select select-type1" style="width:56px;" name="mobileCom" id="mobileCom">
                            <option value="010" selected>010</option>
                            <option value="011">011</option>
                            <option value="016">016</option>
                            <option value="017">017</option>
                            <option value="018">018</option>
                            <option value="019">019</option>
                         
                        </select>
						-
						<input type="text" class="txt" style="width:61px;" maxlength="4" name="telPrx" id="telPrx" onKeyup="numbersOnly(this)" />
						-
						<input type="text" class="txt" style="width:61px;" ass="txt" style="width:61px;" maxlength="4" name="telTail" id="telTail" onKeyup="numbersOnly(this)"/>
						<!-- 
                        <input type="image" src="/kr/images/common/button/btn_pw_find.gif" alt="비밀번호 찾기" onCLick="findPwByHp()"/>
					    -->
                    </td>
				</tr>
                <tr>
                    <th scope="row"><img src="/kr/images/global_menu/txt_global_menu01_01_05.gif" alt="이메일 아이디" /></th>
                    <td>
                        <input type="text" class="txt" style="width:104px;" name="mbrEmlPrx" id="mbrEmlPrx" />
                        @
                        <input type="text" class="txt" style="width:104px;"  name="mbrEmlTail" id="mbrEmlTail"/>
                        <select class="select select-type1" style="width:137px;" name="selEmlTail"  id="selEmlTail" onchange="svrcomChg()" >
                            <option value="" selected>직접입력</option>
                            <option value="naver.com">naver.com</option>
                            <option value="nate.com">nate.com</option>
                            <option value="gmail.com">gmail.com</option>
                            <option value="chol.com">chol.com</option>
                            <option value="dreamwiz.com">dreamwiz.com</option>
                            <option value="empal.com">empal.com</option>
                            <option value="korea.com">korea.com</option>
                            <option value="hotmail.com">hotmail.com</option>
                        </select>
                    
                        <input type="image" src="/kr/images/common/button/btn_pw_find.gif" alt="비밀번호 찾기" onCLick="findNnewPwByHpEml()"/>
                    </td>
                </tr>
                </tbody>
				</table>
			</div>
 <!--    
			<h4 class="subsection in-contents"><img src="/kr/images/title/h4_global_menu01_05.gif" alt="비밀번호 찾기_이메일 아이디 이용" /></h4>
			<p><img src="/kr/images/title/h4_global_menu01_05_desc.gif" alt="회원가입 시 인증 등록하신 이메일로 회원님의 비밀번호를 찾습니다." /></p>
			<div class="boardwrite-wrap02 subsection02">
				<table summary="이메일 아이디">
				<caption>이메일 아이디 작성</caption>
				<colgroup>
					<col width="13%" />
					<col width="87%" />
				</colgroup>
				<tbody>
				<tr>
					<th scope="row"><img src="/kr/images/global_menu/txt_global_menu01_01_05.gif" alt="이메일 아이디" /></th>
					<td>
						<input type="text" class="txt" style="width:104px;" name="mbrEmlPrx" id="mbrEmlPrx" />
						@
						<input type="text" class="txt" style="width:104px;"  name="mbrEmlTail" id="mbrEmlTail"/>
                        <select class="select select-type1" style="width:137px;" name="selEmlTail"  id="selEmlTail" onchange="svrcomChg()" >
                            <option value="" selected>직접입력</option>
                            <option value="naver.com">naver.com</option>
                            <option value="hanmail.net">hanmail.net</option>
                            <option value="nate.com">nate.com</option>
                            <option value="yahoo.co.kr">yahoo.co.kr</option>
                            <option value="Yahoo.com">Yahoo.com</option>
                            <option value="gmail.com">gmail.com</option>
                            <option value="chol.com">chol.com</option>
                            <option value="dreamwiz.com">dreamwiz.com</option>
                            <option value="empal.com">empal.com</option>
                            <option value="korea.com">korea.com</option>
                            <option value="hotmail.com">hotmail.com</option>
                        </select>
                    </td>
						<input type="image" src="/kr/images/common/button/btn_pw_find.gif" alt="비밀번호 찾기" onClick="findNnewPwByHpEml()" />
					</td>
				</tr>
				</tbody>
				</table>
			</div>
-->
            <!-- id find result area
            <h4 class="in-contents"><img src="/kr/images/title/h4_global_menu01_03.gif" alt="비밀번호 전송" /></h4>
            <p><img src="/kr/images/title/h4_global_menu01_03_desc.gif" alt="회원님이 입력하신 정보로 임시 비밀번호를 전송하였습니다.. " /></p>
            <p class="subsection02 id-find-result" id="newPwMsg" name="newPwMsg">
                
            </p>
            <div class="btnwrap">
                <a href="#"><img src="/kr/images/common/button/btn_confirm.gif" alt="확인" onCLick="findPwByEml()"/></a>
            </div>
              -->
            <!-- //id find result area  -->
		</div>
    </form>        
	</div>

	<hr />
    <%@ include file="/WEB-INF/jsp/com/include/footer.jspf" %>